export default{	
	async getDirEntry(target){
		let dirEntry = null;
		await plus.io.requestFileSystem(plus.io.PRIVATE_DOC, 
			function(res){
				dirEntry = res.root;
			},
			function(res){
				console.info(res);
			});
		 
		await new Promise(function (resolve, reject) {
			dirEntry.getDirectory(target,{create:true,exclusive:false},
				function(entry) {
					dirEntry = entry;
					console.info(dirEntry.name + dirEntry.isDirectory);
					resolve();
				},
				function(entry){
					dirEntry = null
					reject();
				});
		})
			
		
			
		return dirEntry;
		
	},
	
	 async copyFile(src,parent,newName){
		 let parentEntry = null;
		 await this.getDirEntry(parent).then(result => {
			 console.info(result.name + "11111111111111");
			 parentEntry = result;
			 
		 });
		 
		 console.info(parentEntry.name + "66666666666666")
		 
		 plus.io.resolveLocalFileSystemURL(src,
		 
		 function success(entry){
			 console.info(entry.name);
			  entry.moveTo(parentEntry,newName,
			  function success(entry){
				  console.info(entry);
				  console.info("移动成功");
			  },
			  function error(entry){
				  console.info("in")
				  console.info(entry);
			  })
			  
		  },  function error(entry){
			  console.info("out")
			  console.info(entry);
		  });
	 }
	

	
}